package com.button.boot.multithread.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.button.boot.multithread.service.ThreadTaskService;

@RestController
public class ThreadTaskController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ThreadTaskController.class);
    
    @Autowired
    private ThreadTaskService threadTaskService;
    
    @GetMapping(path = "/testTask") 
    public String testTask() {
        for(int i = 0; i < 10; i++) {
            threadTaskService.executeAsyncTaskOne(i);
            threadTaskService.executeAsyncTaskTwo(i);
        }
        LOGGER.info("接口测试.");
        return "你好";
    }
}
